package com.itheima.health.controller;

import com.itheima.health.entity.Result;
import com.itheima.health.service.ReportService;
import com.itheima.health.vo.MemberCountVO;
import com.itheima.health.vo.OrdersettingVO;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.ReportVO;
import com.itheima.health.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;


/**
 * @author
 * @Date 2023/9/3 11:41
 * @Version 1.0
 */
@RestController
@RequestMapping("/report")
@Slf4j
public class ReportController {

    @Resource
    private ReportService reportService;

    @GetMapping("getBusinessReportData")
    public Result getBusinessReportData(){
         ReportVO reportVO = reportService.getBusinessReportData();
         return new Result(true, MessageConst.GET_BUSINESS_REPORT_SUCCESS,reportVO);
    }

    @GetMapping("exportBusinessReport")
    public Result exportBusinessReport(HttpServletResponse response){
        reportService.exportBusinessReport(response);
        return new Result(true,MessageConst.ACTION_SUCCESS);


    /**
     * 获取会员数量信息
     */
    @GetMapping("/getMemberReport")
    public Result getMemberReport(){
        MemberCountVO memberCountVO=reportService.getMemberReport();
        return new  Result(true, "获取会员统计数据成功",memberCountVO);
    }

    /**
     * 获取套餐预约信息
     */
    @GetMapping("/getSetmealReport")
    public Result getSetmealReport(){
        OrdersettingVO ordersettingVO =reportService.getSetmealReport();
        return new  Result(true, "获取套餐统计数据成功",ordersettingVO);
    }
}
